package com.java.compilation.helper;

public enum Keyword {
    CLASS,
    METHOD,
    INT,
    FUNCTION,
    BOOLEAN,
    CONSTRUCTOR,
    CHAR,
    VOID,
    VAR,
    STATIC,
    FIELD,
    LET,
    DO,
    IF,
    ELSE,
    WHILE,
    RETURN,
    TRUE,
    FALSE,
    NULL,
    THIS;

    public static boolean isKeyword(String token) {
        for (Keyword value : values()) {
            if (token.equalsIgnoreCase(value.name())) {
                return true;
            }
        }
        return false;
    }

    public static Keyword keyword(String token) {
        for (Keyword value : values()) {
            if (token.equalsIgnoreCase(value.name())) {
                return value;
            }
        }
        return null;
    }
}
